#include "stdio.h"
#include "unistd.h"
#include "sys/types.h"
#include "sys/stat.h"
#include "fcntl.h"
#include "stdlib.h"
#include "string.h"

/*
 * @description		: main主程序
 * @param - argc 	: argv数组元素个数
 * @param - argv 	: 具体参数
 * @return 			: 0 成功;其他 失败
 */
int main(int argc, char *argv[])
{
	int fd, ret;
	char *filename;
	unsigned char angle[1];

	/* 打开flushingPump */
	fd = open("/dev/suctionPump", O_WRONLY);
	if(fd < 0){
		printf("file %s open failed!\r\n", argv[1]);
		return -1;
	}


	/* 向/dev/suctionPump文件写入数据 */
	angle[0] = atoi(argv[1]);
	ret = write(fd, angle, 1);
	if(ret < 0){
		printf("file write failed!\r\n");
		return -1;
	}
	/* 延时3s */
	sleep(3);
	ret = close(fd); /* 关闭文件 */
	if(ret < 0){
		printf("file close failed!\r\n");
		return -1;
	}

	return 0;
}